package com.feizhoutuobang.shapeline.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class StringParser {

	public static String escapeFileName(String s) {
		s = s.replace('\\', '-');
		s = s.replace('<', '-');
		s = s.replace('>', '-');
		s = s.replace('|', '-');
		s = s.replace('*', '-');
		s = s.replace('?', '-');
		s = s.replace('"', '-');
		s = s.replace('/', '-');
		s = s.replace(':', '-');
		return s;
	}

	public static String replaceStringIgnoreCase(String source, String regex, String replacement) {
		Matcher m = Pattern.compile(regex, Pattern.CASE_INSENSITIVE).matcher(source);
		return m.replaceAll(replacement);
	}
}
